---
image: /generated/articles-docs-hardware-acceleration.png
title: Hardware accelerated encoding
sidebar_label: Hardware acceleration
id: hardware-acceleration
crumb: 'Rendering'
---

Encoding is the process of converting a sequence of images into a video file.  
Besides rendering frames, encoding is one of the two steps required to create a video.

From Remotion v4.0.228, Remotion supports hardware-accelerated encoding in some cases.  
Since encoding is platform- and codec-specific, only a few scenarios are supported at the moment.

- Currently, only macOS is supported (Acceleration using VideoToolbox)
- ProRes is supported from v4.0.228, H.264 and H.265 are supported from v4.0.236

## Enable hardware accelerated encoding

By default, hardware acceleration is `"disabled"`.  
You can set the `hardwareAcceleration` option to `"if-possible"` to enable hardware acceleration if it is available.  
If you want the render to fail if hardware acceleration is not possible, set the option to `"required"`.

### In SSR APIs

Use the [`hardwareAcceleration`](/docs/renderer/render-media#hardwareacceleration) option in the [`renderMedia()`](/docs/renderer/render-media) function.

```tsx twoslash {8}
const serveUrl = '/path/to/bundle';
const outputLocation = '/path/to/frames';

import {renderMedia, selectComposition} from '@remotion/renderer';

const inputProps = {
  titleText: 'Hello World',
};

const composition = await selectComposition({
  serveUrl,
  id: 'my-video',
  inputProps,
});

// ---cut---

await renderMedia({
  composition,
  serveUrl,
  codec: 'prores',
  outputLocation,
  inputProps,
  hardwareAcceleration: 'if-possible',
});
```

### In the CLI

Use the [`--hardware-acceleration`](/docs/cli/render#--hardware-acceleration) option in the `npx remotion studio` command.

```bash
npx remotion render MyComp --codec prores --hardware-acceleration if-possible
```

### In the Studio

In the [Remotion Studio](/docs/studio), you can set the hardware acceleration option in the "Advanced" tab when rendering a video.

### With the config file

You can set the [`setHardwareAcceleration()`](/docs/config#sethardwareacceleration) option in the [config file](/docs/config).

```ts twoslash
import {Config} from '@remotion/cli/config';

Config.setHardwareAcceleration('if-possible');
```

### In Remotion Lambda and Cloud Run

These options are not supported in Remotion Lambda and Cloud Run, because those cloud services do not support hardware acceleration.

## File size

Note that the file size is significantly larger by default when using hardware acceleration, likely because less compression is applied.  
We recommend that you use the `--video-bitrate` flag to control the file size.

We find that `--video-bitrate=8M` achieves a similar file size than software encoding when exporting a H.264 Full HD video.

## Tell if hardware acceleration is being used

[Run the render with verbose logging.](/docs/troubleshooting/debug-failed-render)
If the render is using hardware acceleration, you will see a log message like this:

```
Encoder: prores_videotoolbox, hardware accelerated: true
```

Don't rely on the exact wording of the log message to determine if hardware acceleration is being used.

## See also

- [Encoding guide](/docs/encoding)
- [Using the GPU](/docs/gpu)
